<template>
  <div :class="classes" @mouseleave="handleMouseleave" v-if="!isFormItem">
    <input type="hidden" :name="name" :value="currentValue" />
    <div
      v-for="item in count"
      :class="starCls(item)"
      @mousemove="handleMousemove(item, $event)"
      @click="handleClick(item, $event)">
      <span :class="[prefixCls + '-star-content']" type="half"></span>
    </div>
    <div :class="[prefixCls + '-text']" v-if="showText" v-show="currentValue > 0">
      <slot><span>{{ currentValue }}</span> <span v-if="currentValue <= 1">{{ t('i.rate.star') }}</span><span v-else>{{ t('i.rate.stars') }}</span></slot>
    </div>
  </div>
  <!--作为  form-item的 input-->
  <FormItem v-else

            :label="label"
            :labelWidth="labelWidth"
            :labelPosition="labelPosition"
            :rules="rules"
            :showMessage="showMessage"
            :prop="prop"
            :required="required"
            :min="min"
            :max="max"
            :pattern="pattern"
            :patternMessage="patternMessage"
            :validator="validator"
            :doValidate="doValidate"
            :forceValidate="forceValidate"
            @input="handleItemInput">
    <div :class="classes" @mouseleave="handleMouseleave">
      <input type="hidden" :name="name" :value="currentValue" />
      <div
        v-for="item in count"
        :class="starCls(item)"
        @mousemove="handleMousemove(item, $event)"
        @click="handleClick(item, $event)">
        <span :class="[prefixCls + '-star-content']" type="half"></span>
      </div>
      <div :class="[prefixCls + '-text']" v-if="showText" v-show="currentValue > 0">
        <slot><span>{{ currentValue }}</span> <span v-if="currentValue <= 1">{{ t('i.rate.star') }}</span><span v-else>{{ t('i.rate.stars') }}</span></slot>
      </div>
    </div>
  </FormItem>
</template>
<script type="text/ecmascript-6"  src="./index.js"></script>
